<template>
	<view class="content">
		<view class="content-user">
			<input :min="15" :max="30" class="username" v-model="bankCard" placeholder="请输入银行卡号" />
			<input :min="6" :max="30" class="username" v-model="drawAmount" placeholder="请输入提现金额" />
			<input :min="6" :max="30" class="username" v-model="drawAccount" placeholder="请输入提现账号" />
			<input :min="6" :max="30" class="username" v-model="bankMobile" placeholder="银行预留手机号" />
			<input :min="6" :max="30" class="username" v-model="bankName" placeholder="请输入开户人姓名" />
		</view>
		<view>
			<button type="primary" class="login-btn" @click="getuserDisDrow">提交申请</button>
		</view>
	</view>
</template>

<script>
	import {
		get,
		post,
		showToast
	} from '../../js/common';
	export default {
		data() {
			return {
				userId: '',
				drawAmount: '',
				drawWay: 3,
				bankName: '',
				drawAccount: '',
				bankCard: '',
				bankMobile: ''
			};
		},
		methods: {
			getuserDisDrow() {
				if (this.bankCard <= 15 || this.bankCard == '') {
					uni.showToast({
						title: '银行卡号不能为空且不能少于15位',
						icon: 'none'
					});
					return;
				}
				if (this.drawAccount == '') {
					uni.showToast({
						title: '提现账号不能为空',
						icon: 'none'
					});
					return;
				}
				if (this.bankMobile == '') {
					uni.showToast({
						title: '银行预留手机号不能为空',
						icon: 'none'
					});
					return;
				}
				if (this.bankName == '') {
					uni.showToast({
						title: '开户人姓名不能为空',
						icon: 'none'
					});
					return;
				}
				try {
					this.userId = uni.getStorageSync('userId')
					const params = {
						userId: this.userId,
						drawAmount: this.drawAmount,
						drawWay: this.drawWay,
						bankName: this.bankName,
						drawAccount: this.drawAccount,
						bankCard: this.bankCard,
						bankMobile: this.bankMobile
					}
					post('mobileapi/pcdis/userDisDrow', params).then(res => {
						console.log(res)
						uni.showToast({
							title:'申请成功'
						})
						uni.navigateBack(1)
					})
				} catch (e) {}
			}
		}
	}
</script>

<style>
	.content {
		font-size: 28upx;
		background: #ffffff;
		margin: 0upx 20upx;
		border-radius: 20upx;
		padding-bottom: 20upx;
	}

	.content-user {
		margin: 60upx 20upx 0 20upx;
	}

	.username {
		border-bottom: 1px solid #F2F2F2;
		font-size: 28upx;
		height: 60upx;
		padding-top: 10px;
	}

	.login-btn {
		font-size: 32upx;
		margin: 40upx 20upx 20upx 20upx;
		background: #D7000F;
	}
</style>
